Skip to content

Improve handling a datetime field in a sub-type - #113

Merged
manuc66 merged 2 commits into
manuc66:masterfrom
steco:feature/handle-dates
Sep 23, 2020
Merged

manuc66 merged 2 commits into
manuc66:masterfrom
steco:feature/handle-dates

Conversation

@steco

@steco steco commented Sep 21, 2020 •

Copy link
Copy Markdown
Contributor

I ran into an issue where a subtype containing a date field was not deserialised correctly (it appeared that the timezone of the date was changed to my local machine's timezone). This is an attempt at a fix based on a workaround I found for this issue, but would appreciate it if there was a better solution.

steco and others added 2 commits September 22, 2020 20:02
@manuc66
manuc66 merged commit 8f09d72 into manuc66:master Sep 23, 2020
@steco
steco deleted the feature/handle-dates branch September 24, 2020 10:40
@manuc66

manuc66 commented Sep 10, 2022

Copy link
Copy Markdown
Owner

Hello,

The issue should apparently not have been solved in this library, if you want the deserialization to happen as you expect you should deserialize with that settings;

            var obj = JsonConvert.DeserializeObject<MainClass>(json, new JsonSerializerSettings
            {
                DateParseHandling = DateParseHandling.DateTimeOffset
            });

The way it has been solved cause #120

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants